﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PreeRegisterModel;
using PreeRegisterDAL;
using System.Data;
using DrSoftsFrame;

namespace PreeRegisterBLL
{
    public class WorkMonitorBLL
    {
        /// <summary>
        /// 获取未发送排班数量
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static WorkMonitorResponseBodyModel WorkMonitor()
        {
            try
            {

                //获取未发送排班信息
                WorkMonitorResponseBodyModel workMonitorResponseBodyModel = GetNotSendWorkNum();

                return workMonitorResponseBodyModel;
            }
            catch (Exception err)
            {
                throw;
            }
        }

        /// <summary>
        /// 获取未发送排班信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private static WorkMonitorResponseBodyModel GetNotSendWorkNum()
        {
            try
            {
                //查询未发送排班信息
                WorkMonitorResponseBodyModel workMonitorResponseBodyModel = new PreeRegisterModel.WorkMonitorResponseBodyModel();

                //liujia150828
                DataSet ds = WorkMonitorDAL.GetNotSendWorkNum(Common.ToInt(VariableBLL.SynWorkDay));

                //获取未发送排班数量
                List<UpdateDateModel> UpdateDateModel_list = new List<UpdateDateModel>();

                foreach (DataRow drWorkNum in ds.Tables["WorkNum"].Rows)
                {
                    UpdateDateModel updateDateModel = new UpdateDateModel();

                    updateDateModel.Date = drWorkNum["dupdate"].ToString();
                    updateDateModel.Num = drWorkNum["num"].ToString();

                    UpdateDateModel_list.Add(updateDateModel);
                }

                workMonitorResponseBodyModel.updates = UpdateDateModel_list;

                //返回
                return workMonitorResponseBodyModel;
            }
            catch (Exception err)
            {

                throw;
            }
        }
    }
}
